﻿using EYWeb.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace EYWeb.WebLTE.App_Start.Handler
{
    public class GlobalException : HandleErrorAttribute
    {
        public override void OnException(ExceptionContext filterContext)
        {
            base.OnException(filterContext);
            filterContext.ExceptionHandled = true;
            filterContext.HttpContext.Response.StatusCode = 200;
            filterContext.Result = new ContentResult
            {
                Content = new AjaxResult
                {
                    state = ResultType.error.ToString(),
                    message = filterContext.Exception.Message,
                }.ToJson()
            };

        }
    }
}